Skip to content

[ADD] base_bg: Some improvements#351

Closed
joa-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-t-62530-joa-2
Closed

[ADD] base_bg: Some improvements#351
joa-adhoc wants to merge 1 commit intoingadhoc:18.0from
adhoc-dev:18.0-t-62530-joa-2

Conversation

@joa-adhoc
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 22, 2026 15:39
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Este PR introduce mejoras en el módulo base_bg relacionadas con la serialización de datos y el manejo de trabajos en batch. El objetivo principal es mejorar la robustez del sistema de trabajos en segundo plano mediante mejor serialización de parámetros y gestión más completa de trabajos encadenados.

Changes:

  • Nuevo método make_serializable para convertir recursivamente objetos a formato JSON serializable
  • Mejora en bg_enqueue_records para usar el nuevo método de serialización en contexto y parámetros
  • Mejora en action_cancel y action_retry para gestionar correctamente los trabajos siguientes en un batch
  • Tests completos para el nuevo método make_serializable

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
base_bg/models/base_bg.py Agrega método make_serializable y modifica bg_enqueue_records para usar serialización mejorada
base_bg/models/bg_job.py Mejora action_cancel y action_retry para manejar trabajos encadenados en batch
base_bg/tests/test_bg_job.py Agrega tests comprehensivos para make_serializable con diferentes escenarios
Comments suppressed due to low confidence (1)

base_bg/models/bg_job.py:130

  • Los cambios en action_cancel para cancelar también los trabajos siguientes en el batch (línea 125) no tienen cobertura de tests. El test existente test_job_cancel solo verifica el comportamiento básico con un trabajo individual, pero no prueba que los trabajos encadenados también se cancelen correctamente cuando hay next_job_id configurado.

Se recomienda agregar un test que verifique que al cancelar un trabajo, todos los trabajos siguientes en el batch también cambien a estado "canceled".

        (self | self._get_next_jobs()).write(
            {
                "state": "canceled",
                "cancel_time": fields.Datetime.now(),
            }
        )

Comment thread base_bg/models/base_bg.py Outdated
Comment thread base_bg/models/base_bg.py Outdated
Comment thread base_bg/models/base_bg.py Outdated
Comment thread base_bg/tests/test_bg_job.py Outdated
Comment thread base_bg/models/bg_job.py Outdated
Comment thread base_bg/tests/test_bg_job.py Outdated
Comment thread base_bg/models/base_bg.py Outdated
@joa-adhoc joa-adhoc force-pushed the 18.0-t-62530-joa-2 branch 2 times, most recently from c49474c to fd67859 Compare January 22, 2026 15:59
@joa-adhoc joa-adhoc requested a review from Copilot January 22, 2026 15:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

base_bg/models/bg_job.py:130

  • Los cambios en action_cancel ahora también cancelan los trabajos siguientes (_get_next_jobs()). Este nuevo comportamiento no está cubierto por tests. El test test_job_cancel solo verifica que el trabajo actual se cancele, pero no comprueba que los trabajos siguientes en la cadena también se cancelen.

Sugerencia: Agregar un test que verifique que cuando se cancela un trabajo encolado que tiene trabajos siguientes, estos también se cancelen con cancel_time establecido.

        (self | self._get_next_jobs()).write(
            {
                "state": "canceled",
                "cancel_time": fields.Datetime.now(),
            }
        )

Comment thread base_bg/models/base_bg.py Outdated
Comment thread base_bg/models/base_bg.py Outdated
@joa-adhoc joa-adhoc force-pushed the 18.0-t-62530-joa-2 branch 6 times, most recently from be2ce9c to 492805b Compare January 22, 2026 16:58
@joa-adhoc joa-adhoc requested a review from Copilot January 22, 2026 16:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread base_bg/models/bg_job.py Outdated
Comment thread base_bg/models/bg_job.py
- Implement make_serializable method for JSON serialization of various data types
- Update job state handling to include next jobs during cancellation and retry
- Add unit tests
@nicomacr
Copy link
Copy Markdown
Contributor

@roboadhoc r+

roboadhoc pushed a commit that referenced this pull request Jan 22, 2026
- Implement make_serializable method for JSON serialization of various data types
- Update job state handling to include next jobs during cancellation and retry
- Add unit tests

closes #351

Signed-off-by: Nicolas Mac Rouillon (ADV) <[email protected]>
@roboadhoc roboadhoc closed this Jan 22, 2026
@roboadhoc roboadhoc deleted the 18.0-t-62530-joa-2 branch January 22, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants